from time import sleep

from selenium.webdriver.common.by import By

from base.base_page import BasePage
from page.mp_login_page import LoginPage


class MpHomePage(BasePage):

    def __init__(self):
        super().__init__('mp')

        self.ele_content_mag = By.XPATH, '//*[contains(text(), "内容管理")]'

        self.ele_publish_article = By.XPATH, '//*[contains(text(), "发布文章")]'

    def open_publish_article_page(self):

        self.driver.execute_script("arguments[0].click();", self.find_ele(self.ele_content_mag))
        self.driver.execute_script("arguments[0].click();", self.find_ele(self.ele_publish_article))


if __name__ == '__main__':

    LoginPage().login_page()
    sleep(1)
    MpHomePage().open_publish_article_page()